package cn.stylefeng.guns.modular.dailyandrealtimeprices.controller;

import cn.stylefeng.guns.modular.dailyandrealtimeprices.entity.QyuanPowerSdPrices;
import cn.stylefeng.guns.modular.dailyandrealtimeprices.pojo.request.QyuanPowerSdPricesRequest;
import cn.stylefeng.guns.modular.dailyandrealtimeprices.service.QyuanPowerSdPricesService;
import cn.stylefeng.guns.modular.dailyandrealtimeprices.service.QyuanPowerSdPricesService24;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 电价表，记录每天96个时间点的不同电价情况(日前和实时)控制器
 *
 * @author 我是谭先生🐻
 * @date 2025/03/17 11:36
 */
@RestController
@ApiResource(name = "电价表，记录每天96个时间点的不同电价情况(日前和实时)")
public class QyuanPowerSdPricesController {

    @Resource
    private QyuanPowerSdPricesService qyuanPowerSdPricesService;

    @Resource
    private QyuanPowerSdPricesService24 qyuanPowerSdPricesService24;

    /**
     * 获取列表
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @GetResource(name = "获取列表", path = "/qyuanPowerSdPrices24/list")
    public ResponseData<List<QyuanPowerSdPrices>> list24(QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        return new SuccessResponseData<>(qyuanPowerSdPricesService24.findList24(qyuanPowerSdPricesRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @GetResource(name = "分页查询", path = "/qyuanPowerSdPrices24/page")
    public ResponseData<PageResult<QyuanPowerSdPrices>> page24(QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        return new SuccessResponseData<>(qyuanPowerSdPricesService24.findPage24(qyuanPowerSdPricesRequest));
    }


    /**
     * 添加
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @PostResource(name = "添加", path = "/qyuanPowerSdPrices/add")
    public ResponseData<QyuanPowerSdPrices> add(@RequestBody @Validated(QyuanPowerSdPricesRequest.add.class) QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        qyuanPowerSdPricesService.add(qyuanPowerSdPricesRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 删除
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @PostResource(name = "删除", path = "/qyuanPowerSdPrices/delete")
    public ResponseData<?> delete(@RequestBody @Validated(QyuanPowerSdPricesRequest.delete.class) QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        qyuanPowerSdPricesService.del(qyuanPowerSdPricesRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @PostResource(name = "编辑", path = "/qyuanPowerSdPrices/edit")
    public ResponseData<?> edit(@RequestBody @Validated(QyuanPowerSdPricesRequest.edit.class) QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        qyuanPowerSdPricesService.edit(qyuanPowerSdPricesRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看详情
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @GetResource(name = "查看详情", path = "/qyuanPowerSdPrices/detail")
    public ResponseData<QyuanPowerSdPrices> detail(@Validated(QyuanPowerSdPricesRequest.detail.class) QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        return new SuccessResponseData<>(qyuanPowerSdPricesService.detail(qyuanPowerSdPricesRequest));
    }

    /**
     * 获取列表
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @GetResource(name = "获取列表", path = "/qyuanPowerSdPrices/list")
    public ResponseData<List<QyuanPowerSdPrices>> list(QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        return new SuccessResponseData<>(qyuanPowerSdPricesService.findList(qyuanPowerSdPricesRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author 我是谭先生🐻
     * @date 2025/03/17 11:36
     */
    @GetResource(name = "分页查询", path = "/qyuanPowerSdPrices/page")
    public ResponseData<PageResult<QyuanPowerSdPrices>> page(QyuanPowerSdPricesRequest qyuanPowerSdPricesRequest) {
        return new SuccessResponseData<>(qyuanPowerSdPricesService.findPage(qyuanPowerSdPricesRequest));
    }

}
